﻿using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;

namespace EventLogAssembly
{
    public class FeatureModelEventLog
    {
        private static FeatureModelEventLog _eventLogInstance = new FeatureModelEventLog("FeatureModel");
        private readonly string _sSource = "FeatureModel";
        private static readonly string _sLog = "FeatureModel";
        //private static readonly string _sEvent = "Hello";

        private FeatureModelEventLog(string sourceName)
        {
            _sSource = sourceName;
            if (EventLog.SourceExists(sourceName) == false)
            {
                EventLog.CreateEventSource(sourceName, _sLog);
            }
        }

        public static FeatureModelEventLog GetInstance()
        {
            return _eventLogInstance;
        }

        /// <summary>
        /// Write information with event id
        /// </summary>
        /// <param name="info">Information message.</param>
        /// <param name="eventId">Event id.</param>
        public void WriteInfo(string info, EventLogEntryType type, int eventId)
        {
            EventLog.WriteEntry(_sSource, info, EventLogEntryType.Information, eventId);
        }

    }
}
